<HTML><HEAD><TITLE>portray_term(?Term, -TransTerm, +As)</TITLE>
</HEAD><BODY>[ <A HREF="index.html">Term I/O</A> | <A HREF="../../index.html">Reference Manual</A> | <A HREF="../../fullindex.html">Alphabetic Index</A> ]
<H1>portray_term(?Term, -TransTerm, +As)</H1>
Apply portray (write) transformations to Term
<DL>
<DT><EM>Term</EM></DT>
<DD>A term.
</DD>
<DT><EM>TransTerm</EM></DT>
<DD>A variable.
</DD>
<DT><EM>As</EM></DT>
<DD>One of the atoms 'term', 'goal' or 'clause'
</DD>
</DL>
<H2>Description</H2>
    Applies portray-transformations to Term, if any are visible in the
    caller module. If no transformation is visible, TransTerm is identical
    to Term.
    <P>
    This predicate is intended mainly for testing purposes, because
    portray-transformations are normally performed implicitly by the
    term output predicates write/1,2, writeln/1,2, print/1,2,
    display/1,2, printf/2,3 or write_term/2,3.  

<H3>Modes and Determinism</H3><UL>
<LI>portray_term(?, -, +) is det
</UL>
<H3>Modules</H3>
This predicate is sensitive to its module context (tool predicate, see @/2).
<H2>Examples</H2>
<PRE>
    % Given the program:

	:- local portray(s/1, tr_s/2, []).
	tr_s(0, 0).
	tr_s(s(S), N) :- tr_s(S, N1), N is N1+1.


    % Implicit portray transformation by write/1:
    ?- S = s(s(s(0))), write(S).
    3
    yes.

    % Explicit portray transformation
    % Note: no transformation done by writeq/1
    ?- S = s(s(s(0))), writeq(S), portray_term(S, P, term), writeq(P).
    s(s(s(0)))
    3
    yes.
</PRE>
<H2>See Also</H2>
<A HREF="../../kernel/syntax/portray-3.html">portray / 3</A>, <A HREF="../../kernel/compiler/expand_clause-2.html">expand_clause / 2</A>, <A HREF="../../kernel/compiler/expand_goal-2.html">expand_goal / 2</A>, <A HREF="../../kernel/ioterm/expand_macros-2.html">expand_macros / 2</A>
</BODY></HTML>
